import { getRoleTotal,getRoleList } from '../../utils/api'
export default {
    namespaced: true,
    state: {
        roleList: [],
        roleTotal:0
    },
    mutations: {
        roleListInit(state, payload) {
            state.roleList = payload
        },
        roleTotalInit(state, payload) {
            state.roleTotal = payload
        }
    },
    actions: {
        // payload={page,size}
        async getRoleListAction({ commit }, payload) {
            const { data } = await getRoleList(payload)
            if (data.code === 200) {
                commit('roleListInit', data.data)
            }
        },
        async getRoleTotalAction({ commit }) {
            const { data } = await getRoleTotal()
            if (data.code === 200) {
                commit('roleTotalInit', data.data)
            }
        }
    }
}